//!
/**
 ***********************************************************************************************************
 * <RBD3D9Renderer Implementation>
 ***********************************************************************************************************
 * @file RBD3D9Renderer.cpp
 ***********************************************************************************************************/

/***********************************************************************************************************
 * Precompiled Header
 ***********************************************************************************************************/
#include "RBD3D9Renderer.h"
#include "d3d9.h"

bool RBD3D9Renderer::CreateD3D( IDirect3D9Ex** d3d9, IDirect3DDevice9Ex** d3d9_device, void* wnd )
{
	HRESULT hr;

	Direct3DCreate9Ex( D3D_SDK_VERSION, d3d9 );

	D3DPRESENT_PARAMETERS		d3dpp;
	ZeroMemory(&d3dpp, sizeof(d3dpp));
	d3dpp.Windowed				= TRUE;
	d3dpp.SwapEffect			= D3DSWAPEFFECT_DISCARD;
	d3dpp.hDeviceWindow			= (HWND)wnd;
	d3dpp.PresentationInterval	= D3DPRESENT_INTERVAL_IMMEDIATE;

	hr = (*d3d9)->CreateDeviceEx(D3DADAPTER_DEFAULT,
								 D3DDEVTYPE_HAL,
								 (HWND)wnd,
								 D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE,
								 &d3dpp,
								 NULL,
								 d3d9_device);

	return SUCCEEDED(hr);
}

/***********************************************************************************************************/
